<?php

/*
 * Fresns Control Panel (Standalone)
 * Copyright (C) 2021-Present 刘鑫
 * Released under the MIT License.
 */

namespace App\Plugins\FcpApi\TweetAdmin;

use App\Helpers\StrHelper;
use App\Http\Models\Perm\RoleUser;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Schema;

class FsResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'key'       => $this->id,
            'id'        => $this->id,

            'login_name'=> $this->login_name,
            'nickname'  => $this->nickname,
            'api_token' => $this->api_token,
            'user_type' => $this->user_type ?? null,
            'phone'     => $this->phone,
            'email'     => $this->email,
            'phone_desc'=> StrHelper::createPhone($this->phone),
            'is_enable' => boolval($this->is_enable),
            'disabled'  => false,
            'rank_num'  => $this->rank_num ?? null,
            'remark'    => $this->remark,
            'file_id'   => $this->file_id,
            'file_url'  => $this->file_url,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
}
